const onShareAppMessage = (str = '',title = '',imageUrl = '',callback = () => {}) => {
	let pages = getCurrentPages(); //获取当前页面栈的信息
	let currentPage = pages[pages.length - 1]; //获取到当前页面栈中最后一个页面的索引
	let token = uni.getStorageSync('token')
	let userid = uni.getStorageSync('userInfo').id || ''
	let path = currentPage.route+`?userid=${userid}`
	if (token) {
		return {
			title: title,
			path: path + str, //后面是路径上要传递的参数
			imageUrl: imageUrl,
			success(res) {
				uni.showToast({
					title: "分享成功",
					success: () => {
						callback()
					},
				});
			},
			fail(res) {
				uni.showToast({
					title: "分享失败",
					icon: "none",
				});

			},
		}
	} else {
		uni.showToast({
			title: '未登录状态下分享无法绑定上下级关系',
			icon: 'none'
		})
		return {
			title: title,
			path: path + str,
			imageUrl: imageUrl,
			success(res) {
				callback()
			}
		};
	}
}
export default onShareAppMessage